@import '../../styles/colors.less';

.cm-input-wrapper{
    display: inline-block;
    width: 100%;
    position: relative;
    vertical-align: middle;
    line-height: normal;
    &.cm-input-large {
        .cm-input{
            font-size: 16px;
            padding: 6px 7px;
            height: 40px;
        }
    }
    &.cm-input-small {
        .cm-input{
            padding: 1px 7px;
            height: 24px;
            border-radius: 3px;
        }
    }
    &:hover{
        .cm-input{
            border-color: @color-blue;
        }
    }
}
.cm-input {
    display: inline-block;
    width: 100%;
    height: 32px;
    line-height: 1.5;
    padding: 4px 7px;
    font-size: 14px;
    border: 1px solid @color-border;
    border-radius: 4px;
    color: @color-ctx;
    background-color: #fff;
    background-image: none;
    position: relative;
    cursor: text;
    transition: border .2s ease-in-out,background .2s ease-in-out,box-shadow .2s ease-in-out;
    outline: none;
    &:hover,
    &:focus{
        border-color: @color-blue;
    }

    &[disabled] {
        background-color: #f3f3f3;
        opacity: 1;
        cursor: not-allowed;
        color: #ccc;
        &:hover,
        &:focus {
            border-color: @color-border;
        }
    }
    &::-webkit-input-placeholder {
        color: @color-disabled;
    }
    &:-moz-placeholder{
        color: @color-disabled;
    }
    &::-ms-input-placeholder{
        color: @color-disabled;
    }
}
textarea.cm-input{
    resize: none;
    vertical-align: bottom;
}
.cm-input-prefix, .cm-input-suffix {
    width: 32px;
    height: 100%;
    text-align: center;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    > svg {
        width: 16px;
        height: 32px;
        color: @color-sub-title;
        user-select: none;
        margin-top: 0;
    }
    > i {
        font-size: 16px;
        line-height: 32px;
        color: @color-sub-title;
        user-select: none;
    }
}
.cm-input-suffix {
    left: auto;
    right: 0;
}
.cm-input-group-with-prefix{
    .cm-input{
        padding-left: 32px;
    }
}

.cm-input-group {
    display: table;
    width: 100%;
    border-collapse: separate;
    position: relative;
    font-size: 14px;
    top: 1px;
}
.cm-input-group-append,
.cm-input-group-prepend{
    padding: 4px 7px;
    font-size: inherit;
    font-weight: 400;
    line-height: 1;
    color: @color-ctx;
    text-align: center;
    background-color: @color-bg;
    border: 1px solid @color-border;
    border-radius: 4px;
    width: 1px;
    white-space: nowrap;
    vertical-align: middle;
}
.cm-input-group-append,
.cm-input-group-prepend,
.cm-input-group>.cm-input {
    display: table-cell;
}

.cm-input-group-prepend {
    border-right: 0;
}
.cm-input-group-append {
    border-left: 0;
}

.cm-input-group-prepend,
.cm-input-group>.cm-input:first-child {
    border-bottom-right-radius: 0!important;
    border-top-right-radius: 0!important;
}

.cm-input-group-append,
.cm-input-group>.cm-input:last-child {
    border-bottom-left-radius: 0!important;
    border-top-left-radius: 0!important;
}

.cm-input-group-with-prepend .cm-input,
.cm-input-group-with-prepend.cm-input-small .cm-input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.cm-input-group-with-append .cm-input,
.cm-input-group-with-append.cm-input-small .cm-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.cm-input-search {
    cursor: pointer;
    padding: 0 16px!important;
    background: @color-blue!important;
    color: #fff!important;
    border-color: @color-blue!important;
    transition: all .2s ease-in-out;
    position: relative;
    z-index: 2;
    svg {
        width: 16px;
        height: 16px;
    }
    i {
        font-size: 16px;
    }
    &:before{
        content: "";
        display: block;
        width: 1px;
        position: absolute;
        top: -1px;
        bottom: -1px;
        left: -1px;
        background: inherit;
    }
    &:hover {
        background: lighten(@color-blue, 10%)!important;
        border-color: lighten(@color-blue, 10%)!important;
    }
}

.cm-input-clear{
    display: none;
    width: 16px;
    height: 32px;
    line-height: 32px;
    font-size: 16px;
    text-align: center;
    color: #808695;
    position: absolute;
    right: 8px;
    z-index: 3;
    cursor: pointer;
}

.cm-input-wrapper:hover{
    .cm-input-clear{
        display: inline-block;
    }
}